<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../../../css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />

		<title></title>
		<style>
			.mui-table-view::before,.mui-table-view::after,.mui-table-view-cell::after{
				background: none;
			}
			.isSubmit{
				color:#3dda16;
				font-size: 36px;
			}
		</style>
	</head>
	<body class="bg-white">
		<div class="container" id="container">
		  <header class="mui-bar mui-bar-nav">
		      <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		      <h1 class="mui-title">手签文档</h1>
			  <a class="mui-icon mui-icon-right-nav mui-pull-right" @click="nextStep"
			  href="javascript:;"><font size="3" color="#fff">下一步</font></a>
		  </header>
		  <div id="" class="mui-content bg-white">
			  <ul class="mui-table-view">
			      <li class="mui-table-view-cell mui-card mui-media" id="safe">
			          <a href="javascript:;">
			              <img class="mui-media-object mui-pull-right" src="../img/safe.png">
			              <div class="mui-media-body">
			                  安全承诺<span v-if="SafetyCommit" class="mui-icon mui-icon-checkmarkempty mui-pull-right isSubmit"></span>
			                  <p class='mui-ellipsis'>项目入场前必须签写《安全承诺》</p>
			              </div>
			          </a>
			      </li>
			      <li class="mui-table-view-cell mui-card mui-media" id="saftyRing">
			          <a href="javascript:;">
			              <img class="mui-media-object mui-pull-right" src="../img/group_home_5.png">
			              <div class="mui-media-body">
			                  安质环责任书<span v-if="SafetyRing" class="mui-icon mui-icon-checkmarkempty mui-pull-right isSubmit"></span>
			                  <p class='mui-ellipsis'>项目入场前必须签写《安质环责任书》</p>
			              </div>
			          </a>
			      </li>
				  <li class="mui-table-view-cell mui-card mui-media" id="alliance">
				      <a href="javascript:;">
				          <img class="mui-media-object mui-pull-right" src="../img/group_home_1.png">
				          <div class="mui-media-body">
				              价值观认可<span v-if="ValuesForm" class="mui-icon mui-icon-checkmarkempty mui-pull-right isSubmit"></span>
				              <p class='mui-ellipsis'>项目入场前必须签写《价值观认可》</p>
				          </div>
				      </a>
				  </li>
				  
				  
				  
			  </ul>
			
		  </div>
		</div>
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/jquery-1.7.2.min.js"></script>
		<script src="../js/mkeyplus.base.js"></script>
		<script src="../formal/js/api.js"></script>
		<script src="../../../js/vue.js"></script>
		<script src="js/home.js"></script>
		<script>
			var page = undefined;
			var htapi = new HTGlobal();
			var hasExam = false
			
			window.addEventListener('reload',function(data){
				page.load()
				return;
			},false)
			mui.init();
			mui.plusReady(function(){
				page = new Vue({
					name:'home-safe',
					el:'#container',
					data:{
						ValuesForm:false,
						SafetyCommit:false,
						SafetyRing:false
					},
					created(){
						this.load()
					},
					methods:{
						load(){
							//页面初始加载
							var user = localStorage.getItem('outUser');
							if(user){
								user = JSON.parse(user);
								htapi.fetch({appUserId:user.id,projectId:user.currentProjectId,
								enterpriseProjectId:user.enterpriseProjectId},function(data){
									if(data.code==0){
										page.ValuesForm = data.data.ValuesForm || false
										page.SafetyCommit = data.data.SafetyCommit || false
										page.SafetyRing = data.data.SafetyRing || false
									}
									console.log('手签文档：'+JSON.stringify(data))
								},false,'appUserPactisSubmit','post')
								
								htapi.fetch({
								  projectId: user.currentProjectId,
								  appUserId: user.id,
								}, function(data) {
									var D = data.data || []
									if(Array.isArray(D) && D.length>0){
										hasExam = true
									}
								}, false, 'exam')
							}
						},
						nextStep(){
							//前往下一步操作
							 mui.openWindow({
								url: './home-notice.html',
								id: './home-notice.html',
								extras: {},
								waiting: {
								  autoShow: false
								}
							});
						}
					}
				})
				$('#safe').on('tap', function() {
					//安全承诺
					var action = function(){
						if(!hasExam){
							mui.toast('关联项目下未有对应的考试内容，请联系场站负责人！');
							return;
						}
						mui.openWindow({
						  url: './safe.html',
						  id: './safe.html',
						  extras: {},
						  waiting: {
							autoShow: false
						  }
						})
					}
					unifyfn(action)
				});
				$('#alliance').on('tap',function(){
					//价值观认可
					var action = function(){
						if(!hasExam){
							mui.toast('关联项目下未有对应的考试内容，请联系场站负责人！');
							return;
						}
						mui.openWindow({
							url: './alliance.html',
							id: './alliance.html',
							extras: {},
							waiting: {
							  autoShow: false
							}
						})
					}
					unifyfn(action)
				})
				$('#saftyRing').on('tap',function(){
					//安质环责任书
					var action = function(){
						if(!hasExam){
							mui.toast('关联项目下未有对应的考试内容，请联系场站负责人！');
							return;
						}
						mui.openWindow({
							url: './saftyRing.html',
							id: './saftyRing.html',
							extras: {},
							waiting: {
							  autoShow: false
							}
						})
					}
					unifyfn(action)
				});
			})
		</script>
	</body>
</html>
